package com.superzlc.miniweb.servlet;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class DefaultFilter implements Filter {

	public void init(FilterConfig paramFilterConfig) throws ServletException {
	}

	public void doFilter(ServletRequest pRequest, ServletResponse pResponse,
			FilterChain fc) throws IOException, ServletException {
		HttpServletRequest request = (HttpServletRequest) pRequest;
		HttpServletResponse response = (HttpServletResponse) pResponse;

		request.setCharacterEncoding("UTF-8");
		response.setCharacterEncoding("UTF-8");
		response.setHeader("content-type","text/html;charset=UTF-8");

		System.out.println(request.getRequestURL() + "?" + request.getQueryString());
		fc.doFilter(request, response);
	}

	public void destroy() {
	}

}
